package com.sample.demo.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.sample.demo.entity.User;
import com.sample.demo.service.IUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * Created by wangjialei on 2018/10/10.
 */
@Controller
@Slf4j
public class IndexController {

    @Autowired
    private IUserService userService;


    @RequestMapping("/")
    public String index(Model model){
        //log.info("enter index.");

        List<User> users = userService.selectList(new QueryWrapper<User>().le("id", 100));

        model.addAttribute("users", users);
        model.addAttribute("id", 12345);
        return "index";
    }



}
